package com.example.zzm.yuejian03.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.zzm.yuejian03.Bean.ActivBean;
import com.example.zzm.yuejian03.Listener.TListener;
import com.example.zzm.yuejian03.Model.ActivdetailsModel;
import com.example.zzm.yuejian03.R;
import com.squareup.picasso.Picasso;

public class ActivdetailsActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView textView11,textView39,textView40,textView42,textView44,textView46,textView48;
    private ImageView imageView13;
    private Button button14;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activdetails);
        //System.out.println("----查看俱乐部详情");

        initViews();
        initEvent();
        ActivdetailsModel ActivdetailsModel = new ActivdetailsModel();
        ActivdetailsModel.getActivdetailss(getIntent().getIntExtra("activity_id",1),listener);

        //resid  = getIntent().getIntExtra("club_id",1);
    }

    TListener<ActivBean> listener = new TListener<ActivBean>() {
        @Override
        public void onResponse(final ActivBean picture) {
            textView39.setText(picture.getName());
            textView40.setText(picture.getIntro());
            textView42.setText(picture.getTime());
            textView44.setText(picture.getAddress());
            textView46.setText(Integer.toString(picture.getPrice()));
            textView48.setText(Integer.toString(picture.getTel()));
            Picasso.with(ActivdetailsActivity.this)
                    .load("http://10.0.2.2/yuejian10/public/static/asstes/images/" + picture.getPic())
                    .placeholder(R.mipmap.ic_launcher)
                    // .memoryPolicy(MemoryPolicy.NO_CACHE)
                    .into(imageView13);
            button14.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(ActivdetailsActivity.this,BaominactivActivity.class);
                    intent.putExtra("activity_id",picture.getId());
                    startActivityForResult(intent,1);
                }
            });
        }
        @Override
        public void onFail(String msg) {

        }
    };

    private void initViews(){
        textView39 = (TextView)findViewById(R.id.textView39);//mingc
        textView40 = (TextView)findViewById(R.id.textView40);//jieshao
        textView42= (TextView)findViewById(R.id.textView42);//jiaolian
        textView44 = (TextView)findViewById(R.id.textView44);
        textView46 = (TextView)findViewById(R.id.textView46);
        textView48 = (TextView)findViewById(R.id.textView48);
        imageView13 = (ImageView)findViewById(R.id.imageView13);
        textView11 = (TextView) findViewById(R.id.textView11);//fanhui
        button14 = (Button)findViewById(R.id.button14);
    }

    private void initEvent(){
        textView11.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.textView11:
                finish();
                break;
        }
    }
}
